package ooday03;

public class Chick extends Animal {

    public Chick() {
        setLevel(1);
    }

    public Chick(String name, int age, String color, String gender) {
        super(name, age, color, gender);
        setLevel(1);
    }

    @Override
    public void eat() {
        System.out.println(getColor() + "色的" + getAge() + "岁的鸡" + getName() + "正在吃米粒...");
    }

    @Override
    public void drink() {
        System.out.println(getColor() + "色的" + getAge() + "岁的鸡" + getName() + "正在吃米粒...");
    }

    @Override
    public void hunt(Animal a) {
    }

    @Override
    public Chick giveBirthTo() {
        if (!(getGender().equals("female"))) {
            System.out.println(getName() + "是个男娃,不能生娃!!");
            return null;
        }
        if (getAge() <= 2) {
            System.out.println(getAge() + "岁的" + getName() + "还是个孩子,不能生娃");
            return null;
        }
        System.out.println(getColor() + "的" + getAge() + "岁的鸡" + getName() + "生了一只小鸡");
        return new Chick();

    }

    @Override
    public String toString() {
        return "Chick{name = " + getName() + ", age = " + getAge() + ", color = " + getColor() + ", gender = " + getGender() + ", level = " + getLevel() + "}";
    }
}
